<%@page import="com.bean.AdminBean"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	AdminBean admin = (AdminBean)request.getAttribute("admin");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<head>
    <base href="<%=basePath%>">
    
    <title>error</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="CSS/style.css">
	<script type="text/javascript">
		function checkAdmin(form)
		{
			if(form.adminid.value=="")
			  {alert("please input adminid");form.adminid.focus();return false;}
			if(!/^\d+$/.test(form.adminid.value))
			  {alert('adminid is illegal');form.adminid.focus();return false;}
			if(form.adminid.value.length!=8)
			  {alert('adminid length is illegal,8 bits');form.adminid.focus();return false;}
			
			if(form.firstname.value=="")
			  {alert("please input firstname"); form.firstname.focus();return false;}	
			if(!/^[A-Za-z]+$/.test(form.firstname.value))
			  {alert("only charactor is expected for firstname");form.firstname.focus();return false;}
			if(form.password.value.length>10)
			 {alert("password is too long, 10."); form.password.focus();return false;}	
			if(form.lastname.value=="")
			  {alert("only charactor is expected for firstname"); form.lastname.focus();return false;}
			if(!/^[A-Za-z]+$/.test(form.lastname.value))
			  {alert("last name can not contain the number");form.lastname.focus();return false;}
			
			if(form.email.value=="")
			  {alert("please input email"); form.email.focus();return false;}
			if (!/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(form.email.value))
			  {alert("please confirm the E-mail address");form.email.focus();return false;}
			
			form.submit();
			
		}
		</script>

</head>

<body>
<table width="778"  border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top" bgcolor="#FFFFFF">
    <table width="99%" height="510"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tableBorder_gray">
  <tr>
    <td height="510" valign="top" style="padding:5px;"><table width="98%" height="487"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="22" valign="top" class="current_addr">Current address：administrator </td>
      </tr>
      <tr>
        <td align="center" valign="top"><table width="100%" height="493"  border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top">
    
 <%
 	String adminid = "";
	String firstname = "";
	String lastname = "";
	String password = "";
	String email = "";
	String remark = "";
 	if(null!=admin)
 	{
 		adminid = admin.getAdminID();
 		firstname = admin.getFirstname();
 		lastname = admin.getLastname();
 		password = admin.getPassword();
 		email = admin.getEmail();
 		remark = admin.getRemark();
 	}
 %>
	<form name="adminform" method="post" action="AdminModifyServlet?option=submit">
	<table width="700"   border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
     <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      </tr>
     
      <tr>
        <td width="173" align="center" class="attr">Admin ID：</td>
        <td width="427" height="39">
          <input name="adminid" type="text" maxlength="8" value="<%=adminid %>" readonly>
          <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;</font>  </td>
      </tr>
      <tr>
        <td align="center" class="attr">FirstName：</td>
        <td height="39">
        <input name="firstname" type="text" maxlength="30" value="<%=firstname%>">
          <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;</font></td>
      </tr>
      <tr>
        <td align="center" class="attr">LastName：</td>
        <td height="39">
		<input name="lastname" type="text" maxlength="30" value="<%=lastname %>">    
        <font color="red">&nbsp;&nbsp;*</font>
         </td>
      </tr>
      <tr>
        <td align="center" class="attr">Password：</td>
        <td height="39"><input name="password" type="text" maxlength="10" value="<%=password %>">
        <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;</font> 
         </td>
      </tr>
      <tr>
        <td align="center" class="attr">Email：</td>
        <td height="39"><input name="email" type="text" size="50" maxlength="50" value="<%=email %>">
        <font color="red">&nbsp;&nbsp;*&nbsp;&nbsp;</font> 
         </td>
      </tr>
     <tr>
        <td align="center" class="attr">Remark：</td>
        <td>
        <textarea name="remark" cols="30" rows="3" style="overflow-y:auto; resize: none;"><%=remark %></textarea></td>
      </tr>
      <tr>
        <td align="center">&nbsp;</td>
        <td height="39">
        <input type="button" class="btn" value="save" onClick="return checkAdmin(adminform);">
		<input  type="reset" class="btn" value="back" onClick="history.back()"></td>
      </tr>
    </table>
	</form>
	</td>
  </tr>
</table></td>
      </tr>
    </table>
</td>
  </tr>
</table></td>
  </tr>
</table>
</body>
</html>
